<?php
	require_once 'conf.php';
	
	class Conexion_manager{
		private $conn;
		
		public function __construct(){
			$this->conn = false; 
		}
		
		public function getMyConnection(){
			
			global $conf;
			
			try {
				$this->conn = mysql_connect($conf['server']['url'], $conf['server']['user'], $conf['server']['password']);
			}
			catch( Exception $e ) {
				throw new Exception('Could not connect to mysql server');
			}
	        
	        try {
				mysql_select_db($conf['db']['name'], $this->conn);
			}
			catch( Exception $e ) {
				throw new Exception('Could not select database.');
			}
	        
	        return $this->conn;
	    }
	    
	}
?>